/*
Copyright 2010 Sieric
http://sieric.ca

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package vanilla;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

@SuppressWarnings("serial")
public class Section_FTP extends JComponent implements Section {
	private JTextField host, port, username, directory; 
	private JPasswordField password;
	
	public Section_FTP() {
		int y = 1;
		JLabel tmpLbl;
		
		tmpLbl = new JLabel("Host: ");
		host = new JTextField();
		tmpLbl.setBounds(1, y, 80, 20);
		host.setBounds(120, y, 350, 20);
		y += 20;
		add(tmpLbl);
		add(host);
		
		tmpLbl = new JLabel("Port: ");
		port = new JTextField("21");
		tmpLbl.setBounds(1, y, 80, 20);
		port.setBounds(120, y, 50, 20);
		y += 20;
		add(tmpLbl);
		add(port);
		
		tmpLbl = new JLabel("Username: ");
		username = new JTextField();
		tmpLbl.setBounds(1, y, 80, 20);
		username.setBounds(120, y, 350, 20);
		y += 20;
		add(tmpLbl);
		add(username);
		
		tmpLbl = new JLabel("Password: ");
		password = new JPasswordField();
		tmpLbl.setBounds(1, y, 80, 20);
		password.setBounds(120, y, 350, 20);
		y += 20;
		add(tmpLbl);
		add(password);
		
		tmpLbl = new JLabel("Base directory: ");
		directory = new JTextField();
		tmpLbl.setBounds(1, y, 120, 20);
		directory.setBounds(120, y, 350, 20);
		y += 20;
		add(tmpLbl);
		add(directory);
	}
	
	public int getBigHeight() {
		return 105;
	}

	public String getConfig() {
		return "ftp|" + host.getText() + "|" + port.getText() + "|" + username.getText() + "|" + (new String(password.getPassword())) + "|" + directory.getText();
	}

}
